All runs Hypnea musciformis PHOTOSYNTHESIS Analysis, Script Chunks, and Plots

This is the analysis of all the Hypnea musciformis salinity and nutrient experiments conducted on the lanai in St. John 616 from September 2021 to October 2022. These experiments incorporated four paired salinity and nutrient treatments with three temperatures. Each of the first four runs produced an n = 2 and was repeated initially 8 times for a total of n = 16. Data gaps were identified and filled in February, April, and October 2022. This output reflects all data totaling six treatments for Hypnea only.

Packages loaded:

library(lme4)
library(lmerTest)
library(effects)
library(car)
library(MuMIn)
library (dplyr)
library(emmeans)
library(DHARMa)
library(performance)
library(patchwork)
library(rstatix)
#for plots and tables
library(ggplot2)
library(ggpubr)
library(forcats)
library(RColorBrewer)
library(tidyverse)
library(sjPlot)
library(sjmisc)
#library(mmtable2)
library(gt)
library(purrr)
library(stringr)
library(tidyr)

Load and prepare the dataset

Open the output dataset generated by the ps_script_clean_to_ek_alpha.R script in the phytotools_alpha_ek project This file was normalized to quantum efficiency of photosynthesis as this seems to be more accurate (changed in fitWebb input) per Silsbe and Kromkamp (2012)

all_runs_photosyn_data <- read.csv("../data_input/hyp_ulva_all_runs_ek_alpha_normalized.csv")

Assign run as a factor

all_runs_photosyn_data$Run <- as.factor(all_runs_photosyn_data$Run)

Assign temperature as a factor

all_runs_photosyn_data$Temperature <- as.factor(all_runs_photosyn_data$Temp...C.)

Assign treatment as characters from integers then to factors

all_runs_photosyn_data$Treatment <- as.factor(as.character(all_runs_photosyn_data$Treatment))

Assign deltaNPQ as a factor

all_runs_photosyn_data$deltaNPQ <- as.factor(all_runs_photosyn_data$deltaNPQ)

Subset the data and toggle between the species for output. Use Day 9 for final analysis ONLY This will also assign the proper labels for plots

hypnea <- subset(all_runs_photosyn_data, Species == "hm" & RLC.Day == 9)
hypnea$treatment_graph[hypnea$Treatment == 0] <- "1) 35ppt/0.5umol"
hypnea$treatment_graph[hypnea$Treatment == 1] <- "2) 35ppt/14umol" 
hypnea$treatment_graph[hypnea$Treatment == 2] <- "3) 28ppt/27umol" 
hypnea$treatment_graph[hypnea$Treatment == 3] <- "5) 18ppt/53umol" 
hypnea$treatment_graph[hypnea$Treatment == 4] <- "6) 11ppt/80umol"
hypnea$treatment_graph[hypnea$Treatment == 2.5] <- "4) 28ppt/53umol"

Add a column for growth rate from growth rate dataset to the already subsetted hypnea data frame

growth_rate <- read.csv("/Users/Angela/src/work/limu/algal_growth_photosynthesis/data_input/all_runs_growth_011723.csv")
growth_rate$Species <- as.factor(growth_rate$Species)
growth_rate$treatment <- as.factor(growth_rate$treatment)
growth_rate$growth_rate_percent <- (growth_rate$final.weight - growth_rate$Initial.weight) / growth_rate$Initial.weight * 100

Subset for hypnea only and calculate growth rate from final and initial weights

gr_hypnea <- subset(growth_rate, Species == "Hm" & growth_rate_percent > -87.96837)
hypnea$growth_rate <- round((gr_hypnea$final.weight - gr_hypnea$Initial.weight) / gr_hypnea$Initial.weight * 100, digits = 2)

#Run the model Run model for rETRmax with two fixed effect variables and three random effects variables

#run model without interaction between the treatments and temperature
all_runs_photosyn_model_hyp <- lmer(formula = rETRmax ~ Treatment + Temperature + (1 | Run)
                                      + (1 | Plant.ID) + (1 | RLC.Order), data = hypnea)

rETRmax – Make a histogram and residual plots of the data

hist(hypnea$rETRmax, main = paste("Hypnea musciformis rETRmax"), col = "olivedrab3", labels = TRUE)

#or
hypnea %>% ggplot(aes(rETRmax)) +
  geom_histogram(binwidth=5, fill = "#5BB300", color = "black", size = 0.25, alpha = 0.85) +
  theme_bw()

plot(resid(all_runs_photosyn_model_hyp) ~ fitted(all_runs_photosyn_model_hyp))

qqnorm(resid(all_runs_photosyn_model_hyp))
qqline(resid(all_runs_photosyn_model_hyp))

rETRmax – Check the performance of the model

performance::check_model(all_runs_photosyn_model_hyp)

These outputs show the model is acceptable

rETRmax – Check r2 for model fit and print the model statistics summary

r.squaredGLMM(all_runs_photosyn_model_hyp)
## Warning: 'r.squaredGLMM' now calculates a revised statistic. See the help page.
##            R2m       R2c
## [1,] 0.2729647 0.6603186
summary(all_runs_photosyn_model_hyp)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: rETRmax ~ Treatment + Temperature + (1 | Run) + (1 | Plant.ID) +  
##     (1 | RLC.Order)
##    Data: hypnea
## 
## REML criterion at convergence: 2288.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1498 -0.4895 -0.0723  0.4021  4.0779 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  Plant.ID  (Intercept)  96.834   9.840  
##  Run       (Intercept)  36.420   6.035  
##  RLC.Order (Intercept)   4.555   2.134  
##  Residual              120.849  10.993  
## Number of obs: 287, groups:  Plant.ID, 143; Run, 8; RLC.Order, 6
## 
## Fixed effects:
##                Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)    67.18972    5.15950   5.81032  13.023 1.61e-05 ***
## Treatment1     -0.05548    5.90084   5.15560  -0.009    0.993    
## Treatment2     -2.02736    5.90084   5.15560  -0.344    0.745    
## Treatment2.5    9.99208    7.98125   3.77028   1.252    0.283    
## Treatment3      3.71119    5.90084   5.15560   0.629    0.556    
## Treatment4      2.14301    5.90608   5.17441   0.363    0.731    
## Temperature27 -18.98755    3.15062  12.09109  -6.027 5.78e-05 ***
## Temperature30 -19.30286    2.99090  24.57230  -6.454 1.01e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Trtmn1 Trtmn2 Trt2.5 Trtmn3 Trtmn4 Tmpr27
## Treatment1  -0.748                                          
## Treatment2  -0.748  0.928                                   
## Treatmnt2.5 -0.552  0.483  0.483                            
## Treatment3  -0.748  0.928  0.928  0.483                     
## Treatment4  -0.747  0.927  0.927  0.483  0.927              
## Temperatr27 -0.298  0.003  0.003  0.000  0.003  0.002       
## Temperatr30 -0.292  0.000  0.000  0.000  0.000  0.002  0.487

Use Bartlett’s test to check for equal variance

bartlett.test(rETRmax ~ Treatment, data = hypnea)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  rETRmax by Treatment
## Bartlett's K-squared = 16.469, df = 5, p-value = 0.005625

Run Welch’s ANOVA if not equal variances

welch_anova_treatment <- oneway.test(rETRmax ~ Treatment, data = hypnea, var.equal = FALSE)
welch_anova_treatment
## 
##  One-way analysis of means (not assuming equal variances)
## 
## data:  rETRmax and Treatment
## F = 2.3271, num df = 5.00, denom df = 130.67, p-value = 0.04624
welch_anova_temp <- oneway.test(rETRmax ~ Temperature, data = hypnea, var.equal = FALSE)
welch_anova_temp
## 
##  One-way analysis of means (not assuming equal variances)
## 
## data:  rETRmax and Temperature
## F = 34.608, num df = 2.00, denom df = 184.24, p-value = 1.737e-13
games_howell_test(hypnea, rETRmax ~ Treatment, conf.level = 0.95, detailed = FALSE)

rETRmax – Plot and make a table of the results. Also get means for the treatments

plot(allEffects(all_runs_photosyn_model_hyp))

tab_model(all_runs_photosyn_model_hyp)
  rETRmax
Predictors Estimates CI p
(Intercept) 67.19 57.03 – 77.35 <0.001
Treatment [1] -0.06 -11.67 – 11.56 0.993
Treatment [2] -2.03 -13.64 – 9.59 0.731
Treatment [2.5] 9.99 -5.72 – 25.70 0.212
Treatment [3] 3.71 -7.91 – 15.33 0.530
Treatment [4] 2.14 -9.48 – 13.77 0.717
Temperature [27] -18.99 -25.19 – -12.79 <0.001
Temperature [30] -19.30 -25.19 – -13.41 <0.001
Random Effects
σ2 120.85
τ00 Plant.ID 96.83
τ00 Run 36.42
τ00 RLC.Order 4.55
ICC 0.53
N Run 8
N Plant.ID 143
N RLC.Order 6
Observations 287
Marginal R2 / Conditional R2 0.273 / 0.660
hypnea %>% group_by(Treatment) %>% summarise_at(vars(rETRmax), list(mean = mean))
hypnea %>% ggplot(aes(treatment_graph, rETRmax)) + 
  geom_boxplot(size=0.5) + 
  geom_point(alpha = 0.5, size = 3, aes(color = Temperature), show.legend = TRUE) + 
  labs(x="salinity/nitrate", y= "rETRmax (μmols electrons m-2 s-1)", title= "B", subtitle = "Hypnea musciformis") + 
  scale_x_discrete(labels = c("35ppt/0.5umolN", "35ppt/14umolN", "28ppt/27umolN", "28ppt/53umolN", "18ppt/53umolN", "11ppt/80umolN")) +   ylim(-1, 170) + stat_mean() + 
  geom_hline(yintercept=0, color = "purple", size = 0.5, alpha = 0.5) +
  theme_bw() +
  theme(legend.position = c(0.90,0.90), plot.title = element_text(face = "bold", vjust = -15, hjust = 0.05), plot.subtitle = element_text(face = "italic", vjust = -20, hjust = 0.05))

Plot a regression between the photosynthetic independent variables of interest and growth rate

#rETRmax vs. Growth rate
hypnea_growth_etr_graph <- ggplot(hypnea, aes(x=rETRmax, y=growth_rate)) + 
  geom_point(alpha = 0.5, size = 3, show.legend = TRUE, aes(color = Treatment)) + 
  geom_smooth(method = "lm", col = "black") + theme_bw() + 
  labs(title = "Hypnea musciformis rETRmax vs Growth Rate", x = "rETRmax (μmols electrons m-2 s-1)", 
       y = "growth rate (%)") + stat_regline_equation(label.x = 25, label.y = 165) + stat_cor()
hypnea_growth_etr_graph
## `geom_smooth()` using formula 'y ~ x'

#rETRmax vs. Ek
hypnea_etr_ek_graph <- ggplot(hypnea, aes(x=rETRmax, y=ek.1)) + 
  geom_point(alpha = 0.5, size = 3, show.legend = TRUE, aes(color = Treatment)) + 
  geom_smooth(method = "lm", col = "black") + theme_bw() + 
  labs(title = "Hypnea musciformis rETRmax vs Ek", x = "rETRmax (μmols electrons m-2 s-1)", 
       y = "Ek (μmols photons m-2 s-1)") + stat_regline_equation(label.x = 25, label.y = 165) + stat_cor()
hypnea_etr_ek_graph
## `geom_smooth()` using formula 'y ~ x'

Temperature did not have a significant effect on the outcome for rETRmax

Ek – Run the model

Run model for minimum saturating irradiance (Ek) with two fixed effect variables and three random effects variables

all_runs_photosyn_model_ek <- lmer(formula = ek.1 ~ Treatment + Temperature + (1 | Run)
                                      + (1 | Plant.ID) + (1 | RLC.Order), data = hypnea)

Ek – Make a histogram and residual plots of the data for hypnea

hist(hypnea$ek.1, main = paste("Hypnea musciformis Ek"), col = "darkolivegreen3", labels = TRUE)

plot(resid(all_runs_photosyn_model_ek) ~ fitted(all_runs_photosyn_model_ek))

qqnorm(resid(all_runs_photosyn_model_ek))
qqline(resid(all_runs_photosyn_model_ek))

hypnea %>% ggplot(aes(ek.1)) +
  geom_histogram(binwidth=5, fill = "#5BB300", color = "black", size = 0.25, alpha = 0.85) +
  theme_bw()

Ek – Check the performance of the model

performance::check_model(all_runs_photosyn_model_ek)

Ek – Check r2 for model fit and print the model statistics summary

r.squaredGLMM(all_runs_photosyn_model_ek)
##            R2m       R2c
## [1,] 0.3697053 0.5736145
summary(all_runs_photosyn_model_ek)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ek.1 ~ Treatment + Temperature + (1 | Run) + (1 | Plant.ID) +  
##     (1 | RLC.Order)
##    Data: hypnea
## 
## REML criterion at convergence: 2635.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1134 -0.5622 -0.0770  0.4353  3.8754 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  Plant.ID  (Intercept) 115.63   10.753  
##  Run       (Intercept) 129.95   11.400  
##  RLC.Order (Intercept)  13.11    3.621  
##  Residual              540.94   23.258  
## Number of obs: 287, groups:  Plant.ID, 143; Run, 8; RLC.Order, 6
## 
## Fixed effects:
##               Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)     76.631      9.396   6.457   8.156 0.000125 ***
## Treatment1      18.116     10.903   6.014   1.662 0.147542    
## Treatment2      17.444     10.903   6.014   1.600 0.160627    
## Treatment2.5    42.029     14.909   4.589   2.819 0.040925 *  
## Treatment3      17.237     10.903   6.014   1.581 0.164855    
## Treatment4      25.396     10.915   6.040   2.327 0.058620 .  
## Temperature27  -35.800      4.904  19.449  -7.299 5.52e-07 ***
## Temperature30  -38.801      4.607  46.398  -8.422 6.65e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Trtmn1 Trtmn2 Trt2.5 Trtmn3 Trtmn4 Tmpr27
## Treatment1  -0.768                                          
## Treatment2  -0.768  0.905                                   
## Treatmnt2.5 -0.561  0.484  0.484                            
## Treatment3  -0.768  0.905  0.905  0.484                     
## Treatment4  -0.767  0.904  0.904  0.483  0.904              
## Temperatr27 -0.253  0.002  0.002  0.000  0.002  0.001       
## Temperatr30 -0.247  0.000  0.000  0.000  0.000  0.003  0.482

Ek – Run Bartlett’s test and Welch’s ANOVA with Games Howell test for pairwise comparisons

bartlett.test(ek.1 ~ Treatment, data = hypnea)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  ek.1 by Treatment
## Bartlett's K-squared = 6.4027, df = 5, p-value = 0.269
welch_anova_treatment <- oneway.test(ek.1 ~ Treatment, data = hypnea, var.equal = FALSE)
welch_anova_treatment
## 
##  One-way analysis of means (not assuming equal variances)
## 
## data:  ek.1 and Treatment
## F = 9.4662, num df = 5.00, denom df = 130.87, p-value = 1.006e-07
welch_anova_temp <- oneway.test(ek.1 ~ Temperature, data = hypnea, var.equal = FALSE)
welch_anova_temp
## 
##  One-way analysis of means (not assuming equal variances)
## 
## data:  ek.1 and Temperature
## F = 43.715, num df = 2.00, denom df = 187.93, p-value = 2.574e-16
games_howell_test(hypnea, ek.1 ~ Treatment, conf.level = 0.95, detailed = TRUE)

Ek – Plots and tables for the results

tab_model(all_runs_photosyn_model_ek)
  ek.1
Predictors Estimates CI p
(Intercept) 76.63 58.13 – 95.13 <0.001
Treatment [1] 18.12 -3.35 – 39.58 0.098
Treatment [2] 17.44 -4.02 – 38.91 0.111
Treatment [2.5] 42.03 12.68 – 71.38 0.005
Treatment [3] 17.24 -4.23 – 38.70 0.115
Treatment [4] 25.40 3.91 – 46.88 0.021
Temperature [27] -35.80 -45.45 – -26.14 <0.001
Temperature [30] -38.80 -47.87 – -29.73 <0.001
Random Effects
σ2 540.94
τ00 Plant.ID 115.63
τ00 Run 129.95
τ00 RLC.Order 13.11
ICC 0.32
N Run 8
N Plant.ID 143
N RLC.Order 6
Observations 287
Marginal R2 / Conditional R2 0.370 / 0.574
plot(allEffects(all_runs_photosyn_model_ek))

hypnea %>% group_by(Treatment) %>% summarise_at(vars(ek.1), list(mean = mean))
hypnea %>% ggplot(aes(treatment_graph, ek.1)) + 
  geom_boxplot(size=0.5) + 
  geom_point(alpha = 0.5, size = 3, aes(color = Temperature), show.legend = TRUE) + 
  labs(x="salinity/nitrate", y= "Ek (μmols photons m-2 s-1)", title= "B", subtitle = "Hypnea musciformis") + 
  scale_x_discrete(labels = c("35ppt/0.5umolN", "35ppt/14umolN", "28ppt/27umolN", "28ppt/53umolN", "18ppt/53umolN", "11ppt/80umolN")) +   ylim(-1, 240) + stat_mean() + 
  geom_hline(yintercept=0, color = "purple", size = 0.5, alpha = 0.5) +
  theme_bw() +
  theme(plot.title = element_text(face = "bold", vjust = -15, hjust = 0.05), plot.subtitle = element_text(face = "italic", vjust = -20, hjust = 0.05))

plot linear regression Ek with growth rate

hypnea_growth_etr_graph <- ggplot(hypnea, aes(x=ek.1, y=growth_rate)) + 
  geom_point(alpha = 0.5, size = 3, show.legend = TRUE, aes(color = Treatment)) + 
  geom_smooth(method = "lm", col = "black") + theme_bw() + 
  labs(title = "Hypnea musciformis Ek vs Growth Rate", x = "Ek (μmols photons m-2 s-1)", 
       y = "growth rate (%)") + stat_regline_equation(label.x = 25, label.y = 165) + stat_cor()
hypnea_growth_etr_graph
## `geom_smooth()` using formula 'y ~ x'